<template>
  <lay-container fluid="true" style="padding: 10px">
    <div class="docInfo">
      <div class="title">{{ docPost.title }}</div>
      <div class="info">登记人： {{ docPost.nickName }} 登记时间： {{ docPost.insertTime }}</div>
    </div>
    <lay-line></lay-line>

    <div class="docInfo">
      <div class="info">标记： {{ dictFind(docPost.mark) }} 标记时间： {{ docPost.greatTime }} 标记人： {{ docPost.markName }} </div>
    </div>
    <div class="docInfo">
      <div class="remark">备注： {{ docPost.remark }}</div>
    </div>
    <lay-col :md="24" class="saveBtn">
      <lay-button @click="close" type="primary" v-permission="PerKey.DocPost_Mark" prefix-icon="layui-icon-ok-circle">
        关闭
      </lay-button>
    </lay-col>
  </lay-container>
</template>

<script lang="ts" name="PreviewDocPostMark" setup>
import { ref, toRefs, reactive } from "vue";
import { getDocPostMark } from "../../../../../api/module/oas/docpost";
import { PerKey } from "../../../../../library/permissionConst"
import { ViewDocPostMark } from '../../../../../types/doc'
import Util from '../../../../../library/Util'
interface sProps {
  docId: number,
}
const props = withDefaults(defineProps<sProps>(), {
  docId: 0,
});

const docMarkType = ref()
docMarkType.value = Util.dictfilter("Sys_Doc_Mark_Type")
const dictFind = (key: number) => {
  return Util.dictFind(docMarkType.value, key);
}

const data = reactive({
  docPost: <ViewDocPostMark><unknown>[],
})

const { docPost } = toRefs(data)
getDocPostMark(props.docId).then((res) => {
  if (res.status == 1) {
    let data = res.data.data
    docPost.value = {
      title: data.title,
      nickName: data.nickName,
      markName: data.markName,
      insertTime: data.insertTime,
      mark: data.mark,
      remark: data.remark,
      greatTime:data.greatTime
    }
  }
})

const emits = defineEmits(['update:dialogIsOk2'])
const close = function () {
  emits('update:dialogIsOk2', 1)
}
</script>

<style scoped>
.docInfo {
  padding: 5px;
  text-align: center;
}

.title {
  font-size: 20px;
  line-height: 30px;
}

.info {
  font-size: 14px;
  line-height: 22px;
}
.remark{
  line-height: 22px;height: 80px;
  text-align: left;
}
</style>